package model;

import java.awt.Color;
import java.awt.Component;
import java.awt.Insets;

import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import javax.swing.table.TableCellEditor;

public class JTextFieldEditor extends AbstractCellEditor implements
	TableCellEditor {
    private static final long serialVersionUID = -7224333677847581664L;

    private JTextField jtf = null;

    public Object getCellEditorValue() {
	return jtf.getText();
    }

    public Component getTableCellEditorComponent(JTable table, Object value,
	    boolean isSelected, int row, int col) {
	jtf = new JTextField(((String) value));
	jtf.setMargin(new Insets(0, 0, 0, 0));
	jtf.setBorder(new LineBorder(new Color(0, 0, 0)));
	return jtf;
    }

}
